package component;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessor;

/**
 * @author: ZhouBert
 * @date: 2020/9/22
 * @description:	类似 {@link TestInstantiationAwareBeanPostProcessor}
 *
 * AbstractAutowireCapableBeanFactory#populateBean 中会询问 InstantiationAwareBeanPostProcessor#postProcessAfterInstantiation 方法
 * 可以由此决定：是否要继续注入 bean (populateBean)
 */
public class MyInstantiationAwareBeanPostProcessor implements InstantiationAwareBeanPostProcessor {

	/**
	 * 只实现 初始化后的处理
	 * return false 禁止了 属性的注入
	 * @param bean the bean instance created, with properties not having been set yet
	 * @param beanName the name of the bean
	 * @return
	 * @throws BeansException
	 */
	@Override
	public boolean postProcessAfterInstantiation(Object bean, String beanName) throws BeansException {

		return false;
	}
}
